#pragma once

#include "Creature.h"
//#include "Region.h"
#include "Terrain.h"
#include "GameUI.h"
#include "generateMap.h"
#include "Village.h"
#include "Plain.h"
#include <vector>
#include <iostream>

struct Map
{
	int _row = 10;
	int _col = 10;
	std::vector<std::vector<Terrain>> _arr;
	//std::vector<std::vector<Terrain>> _arr = { _row, std::vector<Terrain>(_col) };

	Map()
		:_arr(_row, std::vector<Terrain>(_col))
	{
		std::vector<std::vector<int>> type = generateMap();
		for (int row = 0; row < _arr.size(); ++row)
		{
			for (int col = 0; col < _arr[row].size(); ++col)
			{
				if (type[row][col] == 1)
				{
					_arr[row][col]._region = std::make_shared<Village>();
				}
				else if (type[row][col] == 0)
				{
					_arr[row][col]._region = std::make_shared<Plain>();
				}
			}
		}
	}

	void moveRegion(Game& game);

	void MapShow(int x, int y)
	{
		for (int row = 0; row < _arr.size(); ++row)
		{
			for (int col = 0; col < _arr[row].size(); ++col)
			{
				if (x == col && y == row)
				{
					std::cout << '@';
				}
				else
				{
					std::cout << charMap(_arr[row][col]._type);
				}
			}
			std::cout << std::endl;
		}
	}
};



